﻿'Imports RfidControl

Imports RFIDLIB

Public Class Form1

    Private connStrList As List(Of Dictionary(Of String, String))
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        'RfidControl1.Connstr = "RDType=RD100;CommType=USB;AddrMode=0;SerNum="
        'RfidControl1.Connstr = "RDType=RD201;CommType=COM;COMName=COM6;BaudRate=38400;Frame=8E1;BusAddr=255"
        connStrList = RfidControl1.GetDriverInfoList
        If connStrList IsNot Nothing Then
            For Each ConnStr In connStrList.ToList
                Console.WriteLine(ConnStr.First.Value)
                RfidControl1.Close()
                RfidControl1.Connstr = ConnStr.First.Value
                RfidControl1.Open()
                If RfidControl1.GetReaderInfor IsNot Nothing Then
                    'DrvBtn.Text = ConnStr.First.Key
                    'StatusLabel1.Text = Rfid1.DrvInfo
                    'StatusLabel1.ToolTipText = ConnStr.First.Value
                    Exit For
                End If

            Next
        End If







        'RfidControl1.Open()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        RfidControl1.Close()
    End Sub

    Private Sub RfidControl1_TabsEvent(sender As Object, e As RFIDEventArgs) Handles RfidControl1.TabsEvent
        TextBox1.Text = e.UID
        If e.DataLenght Then
            Dim data = BitConverter.ToString(e.Data).Replace("-", String.Empty)
            Me.Text = data
        End If

    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        MsgBox(RfidControl1.GetReaderInfor())
    End Sub
End Class